home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9563 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news.rain.org!usenet
  2. From: "Guus Leeuw jr." <guusl@eiffel.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: HELP - templates won't compile via Project files...
  5. Date: Sat, 02 Mar 1996 11:01:52 -0800
  6. Organization: Interactive Software Engineering Inc. http://www.eiffel.com/
  7. Message-ID: <31389B20.587AAB7F@eiffel.com>
  8. References: <4h8t4b$oi3@wintermute.ecs.fullerton.edu>
  9. NNTP-Posting-Host: @outback.eiffel.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (X11; I; Linux 1.2.8 i586)
  14.  
  15. Gil Rosin wrote:
  16. > The title says it all, I'm a newbie to C++ and wrote a stack package that
  17. > just did integers, well, I recently tried to convert it to a template.
  18. > Anyways, when I try to compile it, I get linker errors saying that the
  19. > functions can not be found, yet they EXIST!
  20. > I only get those errors for functions that are defined out of line, for example
  21. > I have 3 files:
  22. > STACK.H - class declaration
  23. > STACK.CPP - a few STACK functions
  24. > TEST.CPP - the driver
  25. > I have most of the functions defined inline because they are small, but 3
  26. > I have out of line, Push, Pop and Flush.
  27. > Anyways, in stack.h, I define them in the class like:
  28.  
  29. [ CODE SNIPPED ]
  30.  
  31. > when I compile it in a project file in Borland C++ v3.1, It compiles ok, but
  32. > I get 3 linker errors:
  33. > undefined symbol Flush........
  34. > undefined symbol Push.... in TEST.CPP
  35. > ....
  36. > etc. BUT here's the kicker, when I lump all the 3 files into one file and THEN
  37. > compile the one file, everything works fine, what is going on here?
  38.  
  39. Some compiler don't include the template source file automatically. You will have to it
  40. manually, thru the #include preprocessor directive.
  41.  
  42. Regards,
  43.     Guus
  44.  
  45. PS: If want an answer you should read this group, not your mailbox... ;-)
  46.